﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Cinch;
using System.Diagnostics;

namespace Anata.Client
{
    class DataWrapperHelper2 : DataWrapperHelper
    {
        public static Boolean SomeDirty(IEnumerable<DataWrapperBase> wrapperProperties)
        {

            Boolean someDirty = false;

            foreach (IChangeIndicator wrapperProperty in wrapperProperties)
            {
                try
                {
                    someDirty |= wrapperProperty.IsDirty;
                    if (someDirty)
                        break;
                }
                catch (Exception)
                {
                    someDirty = true;
                    Debug.WriteLine("There was a problem calling " +
                          "the IsDirty method for the current DataWrapper");
                }
            }

            return someDirty;
        }
    }
}
